<?php

/*

Buy Lotto Ticket (buylottoticket.pro.php)

*/
ob_start();
include "global.inc.php";

if ($rand == true)
{
	$first = rand(1,9);
	$second = rand(1,9);
	$third = rand(1,9);
	$fourth = rand(1,9);
	$fifth = rand(1,9);
}

if ($daily == 3)
{
	if ($points < 100)
	{
		die(header(error("daily.php?game=$game&play=3","You can't afford a lotto ticket.")));
	}
	mysql_query("UPDATE members2 SET points=$points-100 WHERE id = '$userid' AND game = '$game'");
	mysql_query("INSERT INTO daily_three2 (user,first,second,third,game) VALUES ('$userid','$first','$second','$third','$game')");
	die(header(error("daily.php?game=$game&play=3","You have purchased a lotto ticket with the numbers $first, $second and $third")));
}

if ($daily == 4)
{
	if ($points < 100)
	{
		die(header(error("daily.php?game=$game&play=4","You can't afford a lotto ticket.")));
	}
	mysql_query("UPDATE members2 SET points=$points-100 WHERE id = '$userid' AND game = '$game'");
	mysql_query("INSERT INTO daily_four2 (user,first,second,third,fourth,game) VALUES ('$userid','$first','$second','$third','$fourth','$game')");
	die(header(error("daily.php?game=$game&play=4","You have purchased a lotto ticket with the numbers $first, $second and $third")));
}

if ($daily == 5)
{
	if ($points < 100)
	{
		die(header(error("daily.php?game=$game&play=5","You can't afford a lotto ticket.")));
	}
	mysql_query("UPDATE members2 SET points=$points-100 WHERE id = '$userid' AND game = '$game'");
	mysql_query("INSERT INTO daily_five2 (user,first,second,third,fourth,fifth,game) VALUES ('$userid','$first','$second','$third','$fourth','$fifth','$game')");
	die(header(error("daily.php?game=$game&play=5","You have purchased a lotto ticket with the numbers $first, $second, $third, $fourth and $fifth")));
}

?>